Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse the connection attempts count logic for PQ PSK negotiation #6295

Conversation

buggmagnet
Copy link
Contributor

@buggmagnet buggmagnet commented May 29, 2024

This PR does the following things :

  • Use the obfuscation logic when making a post quantum connection
  • Rename the ReconnectReason to ActorReconnectReason and move it to the public interface
  • When doing PQ PSK negotiation, send a reconnect message to the actor with a connectionLoss reason
  • Make the PQ PSK negotiation logic reuse the connection attempt counts when using the obfuscation logic algorithm

This change is Reviewable

@buggmagnet buggmagnet added the iOS Issues related to iOS label May 29, 2024
@buggmagnet buggmagnet requested review from rablador and acb-mv May 29, 2024 13:11
@buggmagnet buggmagnet self-assigned this May 29, 2024
Copy link

linear bot commented May 29, 2024

Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 12 of 12 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @buggmagnet)


ios/PacketTunnelCore/Actor/PacketTunnelActor+Public.swift line 41 at r1 (raw file):

     - Parameter nextRelay: next relay to connect to.
     */
    public nonisolated func reconnect(to nextRelay: NextRelay, reconnectReason: ActorReconnectReason = .userInitiated) {

Implicitly "hiding" state related data (with possibly high impact) like this could end up resulting in unexpected behavior in the future.


ios/PacketTunnelCore/Actor/PacketTunnelActorCommand.swift line 22 at r1 (raw file):

        /// Reconnect tunnel.
        case reconnect(NextRelay, reason: ActorReconnectReason = .userInitiated)

Implicitly "hiding" state related data (with possibly high impact) like this could end up resulting in unexpected behavior in the future.

Copy link
Contributor Author

@buggmagnet buggmagnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @rablador)


ios/PacketTunnelCore/Actor/PacketTunnelActor+Public.swift line 41 at r1 (raw file):

Previously, rablador (Jon Petersson) wrote…

Implicitly "hiding" state related data (with possibly high impact) like this could end up resulting in unexpected behavior in the future.

I'm not sure what you mean by that, this is the same code, except that .userInitiated is one abstraction layer above than it used to be now.

Can you clarify what you mean by "hiding state related data" ?

Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @buggmagnet)


ios/PacketTunnelCore/Actor/PacketTunnelActor+Public.swift line 41 at r1 (raw file):

Previously, buggmagnet wrote…

I'm not sure what you mean by that, this is the same code, except that .userInitiated is one abstraction layer above than it used to be now.

Can you clarify what you mean by "hiding state related data" ?

Yeah, I realised afterwards that this was already part of the current impl. What I mean is that defaulting to a state might be risky since this function can be used without realising you're supplying .userInitiated as reconnect reason. By making the param required you will always choose the correct reason, thus preventing possible bugs.

@buggmagnet buggmagnet force-pushed the pq-does-not-work-when-switching-different-port-settings-for-ios-679 branch from ebedeb4 to 66336ae Compare June 4, 2024 10:56
Copy link
Contributor Author

@buggmagnet buggmagnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 8 of 12 files reviewed, 2 unresolved discussions (waiting on @rablador)


ios/PacketTunnelCore/Actor/PacketTunnelActor+Public.swift line 41 at r1 (raw file):

Previously, rablador (Jon Petersson) wrote…

Yeah, I realised afterwards that this was already part of the current impl. What I mean is that defaulting to a state might be risky since this function can be used without realising you're supplying .userInitiated as reconnect reason. By making the param required you will always choose the correct reason, thus preventing possible bugs.

Fair enough, I've made it explicit !


ios/PacketTunnelCore/Actor/PacketTunnelActorCommand.swift line 22 at r1 (raw file):

Previously, rablador (Jon Petersson) wrote…

Implicitly "hiding" state related data (with possibly high impact) like this could end up resulting in unexpected behavior in the future.

Done.

Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@buggmagnet buggmagnet merged commit a746fbe into main Jun 4, 2024
7 checks passed
@buggmagnet buggmagnet deleted the pq-does-not-work-when-switching-different-port-settings-for-ios-679 branch June 4, 2024 12:01
Copy link

github-actions bot commented Jun 4, 2024

🚨 End to end tests failed. Please check the failed workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS Issues related to iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants